/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package name.coolwind.cxblog.service;

import java.util.List;
import name.coolwind.cxblog.dao.BlogDao;
import name.coolwind.cxblog.dao.TagDao;
import name.coolwind.cxblog.domain.Blog;
import name.coolwind.cxblog.util.BlogConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 * @author coolwind
 */
@Service
public class BlogService {
    
    @Autowired
    private BlogDao blogDao;
    
    @Autowired
    private TagDao tagDao;
    /*
    @Autowired
    private BlogConfig blogConfig;
    */
    
    public void createBlog(Blog blog){
        this.blogDao.createBlog(blog);
    }
    
    public Blog getBlogByBlogId(int blogId){
        return this.blogDao.getBlogByBlogId(blogId);
    }
    
    public List<Blog> getBlogsByPage(int pageIndex, int perPage){
        return this.blogDao.getSeveralBlogByPage(pageIndex, perPage);
    }
    
    public List<String> getRencentArc(){
        return this.blogDao.getTimeIntervalByPage(0, 5);
    }
    
    public int getAmountOfBlog(){
        return this.blogDao.getAmountOfBlog();
    }
    /*
    public int getPerPage(){
        return this.blogConfig.getPerPage();
    }
    
    public void setPerPage(int perPage){
        this.blogConfig.setPerPage(perPage);
    }*/
}
